<script setup>
import { reactive, ref, nextTick } from 'vue'
import { onLoad, onShow, onPageScroll, onReachBottom } from '@dcloudio/uni-app'
// 全局页面数据
const data = reactive({
  barHeight: 0,
  navHeight: 0,
  remark: '',
  fileList: [],
  value: 4.9,
  checked: false
})
</script>
<template>
  <view class="all-evaluate-page">
    <view class="total-evaluate-box">
      <view class="total-box">
        <view class="total-score">{{ data.value }}</view>
        <view class="info" @click.stop>
          <up-rate v-model="data.value" size="18" inactiveIcon="star-fill" :disabled="false" inactiveColor="#D9D9D9"
            activeColor="#FFB13B"></up-rate>
          <view class="total-num">共315条评价</view>
        </view>
      </view>
      <view class="evaluate-box">
        <view class="evaluate-item">
          <view class="label">好评</view>
          <up-line-progress :percentage="95" height="3" activeColor="#11B01A" inactiveColor="#D9D9D9"
            :showText="false"></up-line-progress>
          <view class="percentage">
            95%
          </view>
        </view>
        <view class="evaluate-item">
          <view class="label">中评</view>
          <up-line-progress :percentage="5" height="3" activeColor="#11B01A" inactiveColor="#D9D9D9"
            :showText="false"></up-line-progress>
          <view class="percentage">
            5%
          </view>
        </view>
        <view class="evaluate-item">
          <view class="label">差评</view>
          <up-line-progress :percentage="0" height="3" activeColor="#11B01A" inactiveColor="#D9D9D9"
            :showText="false"></up-line-progress>
          <view class="percentage">
            0%
          </view>
        </view>
      </view>
    </view>
    <view class="list">
      <view class="item" v-for="(item, index) in 3" :key="index">
        <!-- 头部 -->
        <view class="head-box">
          <up-avatar :src="`https://cdn.uviewui.com/uview/swiper/swiper1.png`"></up-avatar>
          <view class="info">
            <view class="name">
              <text>{{ `Roman Yarv` }}</text>
              <up-rate :count="5" readonly v-model="data.rateNum" :allowHalf="true" inactiveColor="transparent"
                activeColor="#FFB13B"></up-rate>
            </view>
            <view class="time">{{ `09月12日` }}</view>
          </view>

        </view>
        <!-- 评价文字 -->
        <view class="cnt">
          <text>{{ `今天体验了王教练的课程，果然不一样，新店环境让人在这里锻炼也很舒服，值得推荐👍🏻` }}</text>
        </view>
        <view>
          <!-- 图片列表 -->
          <view class="picList">
            <view v-for="(src, index) in 3" :key="index" class="pic-item">
              <u-image :src="`https://cdn.uviewui.com/uview/swiper/swiper1.png`" width="148rpx" height="148rpx"
                mode="aspectFill" />
            </view>
          </view>
        </view>
      </view>
    </view>
  </view>

</template>

<style lang="scss" scoped>
.all-evaluate-page {
  padding: 24rpx 32rpx;
  background: #F6F6F6;
  min-height: 100vh;

  & .total-evaluate-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 32rpx 30rpx;
    background: #FFFFFF;
    border-radius: 24rpx;

    & .total-box {
      padding-right: 20rpx;
      display: flex;
      align-items: center;
      position: relative;
      z-index: 1;

      &::before {
        content: "";
        position: absolute;
        left: 0;
        right: 0;
        bottom: 0;
        top: 0;
        z-index: 2;
        // background: #FFFFFF;
      }

      & .total-score {
        font-weight: 500;
        font-size: 92rpx;
        line-height: 108rpx;
        background: linear-gradient(90deg, #01EF0C 0%, #0b8011 100%);
        background-clip: text;
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
      }

      & .info {
        margin-left: 12rpx;

        & .total-num {
          padding-top: 12rpx;
          font-weight: 400;
          font-size: 24rpx;
          color: #B7B7B7;
        }
      }
    }

    & .evaluate-box {
      position: relative;
      width: 212rpx;
      flex: 1;
      padding-left: 20rpx;

      &::before {
        content: "";
        position: absolute;
        left: 0;
        top: 0;
        height: 107rpx;
        border-radius: 0rpx 0rpx 0rpx 0rpx;
        border: 2rpx solid #B7B7B7;
        opacity: 0.3;
      }

      & .evaluate-item {
        display: flex;
        align-items: center;

        &:not(:first-child) {
          margin-top: 8rpx;
        }

        & .label {
          margin-right: 8rpx;
          width: 48rpx;
          font-weight: 400;
          font-size: 24rpx;
          color: #B7B7B7;
        }

        &::v-deep .u-line-progress {
          width: 144rpx;
        }

        & .percentage {
          margin-left: 8rpx;
          width: 54rpx;
          text-align: right;
          font-weight: 400;
          font-size: 24rpx;
          color: #B7B7B7;
        }
      }
    }
  }

  & .list {
    margin-top: 32rpx;
    background-color: #fff;
    border-radius: 24rpx;

    & .item {
      padding: 32rpx;
      position: relative;

      &:not(:last-child):after {
        content: '';
        position: absolute;
        bottom: 0;
        width: 622rpx;
        display: block;
        border: 2rpx solid;
        opacity: 0.5;
        border-image: linear-gradient(270deg, rgba(217, 217, 217, 0), rgba(217, 217, 217, 1), rgba(217, 217, 217, 0)) 2 2;
      }

      & .head-box {
        display: flex;
        align-items: center;

        & .info {
          margin-left: 12rpx;

          & .name {
            display: flex;
            align-items: center;

            & text {
              margin-right: 14rpx;
              font-weight: 400;
              font-size: 28rpx;
              color: #303133;
            }
          }

          & .time {
            margin-top: 6rpx;
            font-weight: 400;
            font-size: 20rpx;
            color: #838385;
          }
        }
      }

      & .cnt {
        margin-top: 24rpx;
        font-weight: 400;
        font-size: 28rpx;
        color: #303133;
      }

      & .picList {
        display: flex;
        flex-wrap: wrap;
        gap: 12rpx; // 图片之间的间距
        margin-top: 16rpx;

        & .pic-item {
          border-radius: 8rpx;
          overflow: hidden;
        }
      }
    }
  }
}
</style>